package leetcode.每日一题;

import org.junit.Test;

import java.util.Arrays;

/**
 * @author :songyaozhang
 * @date :Created 2021/8/11 10:18
 * @description :https://leetcode-cn.com/problems/longest-continuous-increasing-subsequence/
 */
public class 最长连续递增序列 {
    @Test
    public void test() {
        Solution solution = new Solution();
        System.out.println(solution.findLengthOfLCIS(new int[]{1,3,5,4,7}));
    }
    class Solution {
        public int findLengthOfLCIS(int[] nums) {
            int n = nums.length;
            if (n == 0) return 0;
            int l = 0, r = l + 1;
            int max = 1;
            while (r < n) {
                if (nums[r] > nums[r - 1]) r++;
                else {
                    max = Math.max(max, r - l);
                    l = r;
                    r++;
                }
            }
            max = Math.max(max, r - l);
            return max;
        }
    }

}
